package com.wei.czz.framework.game.controller;

import com.wei.czz.common.annotation.Auth;
import com.wei.czz.common.dto.game.FlowDto;
import com.wei.czz.common.tool.Result;
import lombok.AllArgsConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;

import com.wei.czz.framework.game.service.GamePrizeFlowService;
import java.util.List;

/**
 * Created by IntelliJ IDEA.
 *
 * @author wei
 * date: 2023-03-16 11:37:01
 * className: GamePrizeFlowController 游戏奖品变更流水请求接口类
 * version: 1.0
 * description:
 */
@RestController
@RequestMapping("/game-prize-flow")
@AllArgsConstructor
public class GamePrizeFlowController {

    private static final Logger log = LoggerFactory.getLogger(GamePrizeFlowController.class);

    private final GamePrizeFlowService gamePrizeFlowService;

    /**
     * 获取游戏奖品流水列表接口
     * <p>
     * 调用方：
     *  1、浏览器-后台管理页-游戏奖品管理页-游戏奖品流水弹出框调用
     *
     * @param prizeId 游戏奖品主键
     * @return 游戏奖品流水列表
     */
    @GetMapping("/list")
    @Auth(permit = "game:prize:get")
    public Result<List<FlowDto>> getPrizeFlowList(@RequestParam("prizeId") Long prizeId){
        log.info("开始获取游戏奖品流水列表业务。prizeId={}", prizeId);

        List<FlowDto> flowDtoList = gamePrizeFlowService.getPrizeFlowList(prizeId);

        log.info("获取游戏奖品流水列表业务结束");
        return Result.success(flowDtoList);
    }

}
